/*package com.rykj.qxj.aop;

import java.lang.reflect.Method;
import java.util.Date;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.rykj.qxj.annotation.Operation;
import com.rykj.qxj.server.model.entity.ApiManage;
import com.rykj.qxj.server.model.entity.ApiOperationRecord;
import com.rykj.qxj.server.services.IApiManageService;
import com.rykj.qxj.server.services.IApiOperationRecordService;

import lombok.extern.log4j.Log4j;
*//**
 * @Description:接口操作记录，切面处理类      
 * @date:   2019年3月21日 上午10:19:56  
 * @author: wangshunyi
 *//*
@Log4j
@Aspect
@Component
public class ApiOperationRecordAspect {
	
	@Autowired
	private IApiOperationRecordService apiOperationRecordService;
	
	@Autowired
	private IApiManageService apiManageService;
	//定义切点 @Pointcut 
    //在注解的位置切入代码
    @Pointcut("@annotation(com.rykj.qxj.annotation.Operation)")
    public void logPoinCut() {
    }
 
    //切面 配置通知
    @AfterReturning("logPoinCut()")
    public void saveApiOperationRecord(JoinPoint joinPoint) {
        log.info("进入切面，进行保存接口变动记录");
        //保存操作记录
        ApiOperationRecord apiOperationRecord = new ApiOperationRecord();
        //从切面织入点处通过反射机制获取织入点处的方法
        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
        //获取切入点所在的方法
        Method method = signature.getMethod();
        //获取操作
        Operation operation = method.getAnnotation(Operation.class);
        String value=null;
        if (operation != null) {
            value = operation.value();
            apiOperationRecord.setChangeType(value);//保存具体的操作
        }
        //获取请求的类名
        //String className = joinPoint.getTarget().getClass().getName();
        //获取请求的方法名
        //String methodName = method.getName();
        //请求的参数
        Object[] args = joinPoint.getArgs();
        if("删除".equals(value)) {
        	Integer id=(Integer) args[0];
        	ApiManage delApiManage = apiManageService.selectByPrimaryKey(id);
        	//审核人
            apiOperationRecord.setApiVerifyBy(delApiManage.getVerifyBy());
            //审核状态
            apiOperationRecord.setApiVerifyStatus(delApiManage.getApiVerifyStatus());
            //审核时间
            apiOperationRecord.setApiVerifyTime(delApiManage.getVerifyTime());
            //操作时间
            apiOperationRecord.setChangeTime(new Date());
            //接口版本
            //apiOperationRecord.setVersion(delApiManage.getVersion());
            //接口的id
            apiOperationRecord.setApiId(delApiManage.getId());
            if(log.isDebugEnabled()) {
            	log.debug("apiOperationRecord="+apiOperationRecord.toString());
            }
        }else {
        	ApiManage apiManage=(ApiManage) args[0];
        	//审核人
            apiOperationRecord.setApiVerifyBy(apiManage.getVerifyBy());
            //审核状态
            apiOperationRecord.setApiVerifyStatus(apiManage.getApiVerifyStatus());
            //审核时间
            apiOperationRecord.setApiVerifyTime(apiManage.getVerifyTime());
            //操作时间
            apiOperationRecord.setChangeTime(new Date());
            //接口版本
            //apiOperationRecord.setVersion(apiManage.getVersion());
            //接口的id
            apiOperationRecord.setApiId(apiManage.getId());
            if(log.isDebugEnabled()) {
            	log.debug("apiOperationRecord="+apiOperationRecord.toString());
            }
        }
        apiOperationRecordService.saveApiOperationRecord(apiOperationRecord);
    }
}
*/